import {summaryView} from "@/views/wy-budget/api/budgetinitiate.js";
import {getApply} from "@/views/wy-budget/api/budgetparameter.js";
export default {
    data() {
        return {
            //弹出框 初始时隐藏

            dialogVisible: false,
            lists: [],
            clos: [
                {prop: "subjects", label: "科目",idLabel:''},
                {prop: "comprehensive", label: "综合部",idLabel: 'comprehensiveApplyId'},
                {prop: "propertyRights", label: "产权部", idLabel:'propertyRightsApplyId'},
                {prop: "contentCanal", label: "物业部",idLabel:'contentCanalApplyId'},
                {prop: "business", label: "经营部",idLabel: 'businessApplyId'},
                {prop: "propertyDepartment", label: "财务部",idLabel: 'propertyDepartmentApplyId'},
                {prop: "manage", label: "管理所",idLabel:'manageApplyId'},
                {prop: "summary", label: "汇总",idLabel:''}
            ],
            tableData: [],
            loading: true,

        }
    },
    mounted() {
    },
    created() {
    },
    methods: {
        //展示新增弹框
        show(rowData) {
            this.loading = true;
            summaryView(rowData.budgetCode).then((resp) => {
                let obj = resp.data.data;
                this.tableData = obj;
                this.loading = false;
            }).catch(error => {
                this.$alert('操作失败', '提示', {
                    confirmButtonText: '确定',
                });
            }).finally(() => this.loading = false);

            this.dialogVisible = true;
        },

        /**
         * 关闭弹窗
         * @param done
         */
        beforeClose(done){
            this.dialogVisible = false
            done();
        },

        /**
         * 跳转到申报查看页面
         * @param scope
         */
        async toLookData3(applyId) {
            if(!applyId) return;
            // 查询预算信息
            const resp1 = await getApply(applyId)

            if(resp1 && resp1.data && resp1.data.data){
                if(resp1.data.data.isEdit == '1'){

                    if(resp1.data.data.budgetType == '11'){
                        // 预算申请
                        this.$router.push({name: 'sumapply_look2', query: {'applyId': resp1.data.data.applyId,'fileId':resp1.data.data.fileId,'fileId2':resp1.data.data.fileId2} })
                    }else if(resp1.data.data.budgetType == '12'){
                        // 预算调整
                        this.$router.push({name: 'sumadjust_look', query: {'applyId': resp1.data.data.applyId,'fileId':resp1.data.data.fileId,'fileId2':resp1.data.data.fileId2,'fileId3':resp1.data.data.applyFileId,'fileId4':resp1.data.data.applyFileId2} })
                    }else if(resp1.data.data.budgetType == '13'){
                        // 经费追加
                    }
                }else{
                    if(resp1.data.data.budgetType == '11'){
                        // 预算申请
                        this.$router.push({name: 'sumapply_look', query: {'applyId': resp1.data.data.applyId,'fileId':resp1.data.data.fileId,'fileId2':resp1.data.data.fileId2} })
                    }else if(resp1.data.data.budgetType == '12'){
                        // 预算调整
                        this.$router.push({name: 'sumadjust_look', query: {'applyId': resp1.data.data.applyId,'fileId':resp1.data.data.fileId,'fileId2':resp1.data.data.fileId2,'fileId3':resp1.data.data.applyFileId,'fileId4':resp1.data.data.applyFileId2} })
                    }else if(resp1.data.data.budgetType == '13'){
                        // 经费追加
                    }
                }
            }
        },


    }


}
